package com.design.patterns.list.observer;

/**
 * @author Wangzhiwen
 */
public class ObserverClient {

    public static void main(String[] args) {
        // Subject
        WeatherSubject weatherSubject = new WeatherSubject();

        // Observer
        BaiduSite baiduWeatherSite = new BaiduSite();
        SinaSite sinaWeatherSite = new SinaSite();

        // Register
        weatherSubject.registerObserver(baiduWeatherSite);
        weatherSubject.registerObserver(sinaWeatherSite);

        // Publish Update
        weatherSubject.publishWeather(25.6F, 1000.56F, 12.5F);

        // Result
        System.out.println(baiduWeatherSite.getWeather());
        System.out.println(sinaWeatherSite.getWeather());
    }

}
